﻿using System;
using System.Linq;

namespace Model.Manager.DataBase
{
    /// <summary>
    ///     数据库容器接口
    /// </summary>
    public interface IDbContext : IDisposable
    {
        /// <summary>
        ///     隐式事务提交
        /// </summary>
        /// <returns></returns>
        Int32 SaveAllChange();


        /// <summary>
        ///     获取实体的操作
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <returns></returns>
        IOperator<TEntity> GetOperator<TEntity>() where TEntity : class;

        /// <summary>
        ///     获取实体的Linq,方便复合查询
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <returns></returns>
        IQueryable<TEntity> Queryable<TEntity>() where TEntity : class;
    }
}